home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
PROGRAMMING
/
Raven 1.2 Examples.sit
/
Raven 1.2 Examples
/
Quill
/
Source
/
Main.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1997-02-21
|
4KB
|
168 lines
/*
* File: Main.cpp
* Summary: The big enchilada.
* Written by: Jesse Jones
*
* Copyright ゥ 1996 Jesse Jones. Permission to use, copy, modify, and distribute this
* file as source or object code is hereby granted without fee. Permission to sell the
* source code is granted only to non-profit institutions. This file is provided 'as is'
* without express or implied warranty.
*
* Change History (most recent first):
*
* <-> 2/24/96 JDJ Created.
*/
#include <List.h>
#include <ZAppBootStrap.h>
#include <ZFloatingDesktop.h>
#include <ZGestalt.h>
#include <ZMemoryHeap.h>
#include <ZNewAndDelete.h>
#include <ZPreferences.h>
#include <ZStringUtils.h>
#if RAVEN_OPERATOR_NEW
#include <ZBestFitAllocator.h>
#include <ZMemoryHeap.h>
#include <ZNewAndDelete.h>
#include <ZSimpleAllocator.h>
#endif
#include "Application.h"
// ===================================================================================
// class TBootStrap
// ===================================================================================
//---------------------------------------------------------------
//
// TBootStrap::DoEarlyInit
//
//---------------------------------------------------------------
void TBootStrap::DoEarlyInit()
{
const long kInitialObjectHeapSize = 1500*1024L;
const long kObjectHeapIncrementSize = 32*1024L;
const short kNumMasterPtrBlocks = 10;
for (short i = 1; i <= kNumMasterPtrBlocks; i++)
MoreMasters();
#if RAVEN_OPERATOR_NEW // on by default
ASSERT(gObjectHeap == nil);
TAllocator* alloc = new TBestFitAllocator(kInitialObjectHeapSize, kObjectHeapIncrementSize);
gObjectHeap = new TMemoryHeap(alloc);
#else
_prealloc_newpool(kInitialObjectHeapSize);
_set_newpoolsize(kObjectHeapIncrementSize);
_set_newnonptrmax(kObjectHeapIncrementSize/4);
#endif
}
#pragma mark -
// ===================================================================================
// class CMyBooter
// ===================================================================================
class CMyBooter : public TAppBootStrap {
typedef TAppBootStrap Inherited;
//-----------------------------------
// Initialization/Destruction
//
public:
virtual ~CMyBooter();
CMyBooter();
//-----------------------------------
// Inherited API
//
protected:
virtual void OnSystemNeeds(list<string, allocator<string> >& needs);
virtual void OnBoot();
};
//---------------------------------------------------------------
//
// CMyBooter::~CMyBooter
//
//---------------------------------------------------------------
CMyBooter::~CMyBooter()
{
}
//---------------------------------------------------------------
//
// CMyBooter::CMyBooter
//
//---------------------------------------------------------------
CMyBooter::CMyBooter()
{
mIdealDisplayMode = SDisplayMode(640, 480, 8);
}
//---------------------------------------------------------------
//
// CMyBooter::OnSystemNeeds
//
//---------------------------------------------------------------
void CMyBooter::OnSystemNeeds(list<string, allocator<string> >& needs)
{
Inherited::OnSystemNeeds(needs);
if (!UGestalt::hasDragMgr)
needs.push_back(LoadIndString(257, 5));
}
//---------------------------------------------------------------
//
// CMyBooter::OnBoot
//
//---------------------------------------------------------------
void CMyBooter::OnBoot()
{
Inherited::OnBoot();
gObjectHeap->AddAllocator(20, 2000);
gObjectHeap->AddAllocator(16, 500);
gObjectHeap->AddAllocator(12, 1500);
TFloatingDesktop::Init();
UPreferences::Init(LoadIndString(257, 6), 'QUIL');
}
#pragma mark -
//---------------------------------------------------------------
//
// Main
//
//---------------------------------------------------------------
void main()
{
CMyBooter booter;
booter.Boot();
// (void) new int;
{
CApplication theApp;
theApp.Run();
}
}